package com.bankwel.j2d.model;

import java.awt.Graphics;

public class Circle extends Object2d {

	private float radius;

	public Circle(float x, float y, float r) {
		super(x, y);
		radius = r;
	}

	public float getRadius() {
		return radius;
	}

	public void setRadius(float radius) {
		this.radius = radius;
	}

	/*
	 * @Override public boolean restrainIn(float x1, float x2, float y1, float
	 * y2) { return super.restrainIn(x1 + radius, x2 - radius, y1 + radius, y2 -
	 * radius); }
	 */

	@Override
	public void draw(Graphics g) {
		float px = getRef().getX();
		float py = getRef().getY();
		float r = radius;
		g.fillOval((int) (px - r), (int) (py - r), (int) (2 * r), (int) (2 * r));
	}
}
